var contextPath = $("#contextPath").val();
$(function() {
	var vipcode = $("#vipcode").val();
	var domain = $("#domain").val();
	var add_href = domain + contextPath + "/friend/toRegister?code=" + vipcode;
	/* $("#invite_friend").attr("data-clipboard-text",add_href); */
	/*
	 * var clipboardDemos = new Clipboard('[data-clipboard-text]');
	 * clipboardDemos.on('success', function(e) { if
	 * (navigator.userAgent.indexOf('UCBrowser') > -1) { layer.open({ content: '<div
	 * class="tips_copy"><div class="tips_copy_input tl"><p>'+add_href+'</p></div><div
	 * class="tips_copy_mask">请手动复制!</div></div>' }); return false; }
	 * e.clearSelection(); layer.open({ content:'《 您已复制邀请链接，可将链接直接发送给您的好友！》',
	 * time: 2 }); });
	 */

	/*
	 * clipboardDemos.on('error', function(e) { layer.open({ content: '<div
	 * class="tips_copy"><div class="tips_copy_input tl"><p>'+add_href+'</p></div><div
	 * class="tips_copy_mask">请手动复制!</div></div>' }); });
	 */
	if (null != vipcode) {
		$("#two_dimension_code").next("img").attr("src",
				contextPath + "/common/qr_code.img?code_url=" + add_href);
	}

	/*
	 * var btns = $('#imgcode'); btns.on('click',function(){ layer.open({
	 * content: '<img id="img" alt="" height="210" width="210"
	 * src='+contextPath+'/common/qr_code.img?code_url='+add_href+'>', style:
	 * '', time: 0 }); });
	 */
	$('#invite_friend').on("click",function() {
		layer.open({
					content : '<img id="img" alt="" height="210" width="210" src='+ contextPath+ '/common/qr_code.img?code_url='+ add_href + '>',
						style : '',
						time : 0
					});
					})
	var vipupdate = $("#vipupdate");
	var vipimg = $("#vipimg");

	var input = $("#input").val();

	if (input != 0) {
		vipupdate
				.append('<div> <span class="icon_vip_06"></span></div><p class="vip__nav_txt">VIP升级</p>');
		vipimg.append(' <span class="dib vm vip__vipgrade"><img src="'
				+ contextPath + '/static/images/icon_vipgrade_0'
				+ $.trim(input) + '.png" alt=""></span>');
	} else {
		vipupdate
				.append('<div> <span class="icon_vip_06"></span></div><p class="vip__nav_txt">升级为VIP</p>');
	}

});